import {postRequest, getRequest} from '@/common/request'
import {urls} from './url'

const protocolApi = urls.protocol;

function list(param, page, pageSize, success, complete) {
  postRequest(protocolApi.list + '?currentpage=' + page + '&pagesize=' + pageSize, {}, param, success, complete)
}

function add(param, success, complete) {
  postRequest(protocolApi.add, {}, param, success, complete)
}

function update(param, success, complete) {
  postRequest(protocolApi.update, {}, param, success, complete)
}

function remove(ids, success, complete) {
  postRequest(protocolApi.del, {}, ids, success, complete)
}

function load(id, success, complete) {
  getRequest(protocolApi.load + id, {}, success, complete)
}

function batchRemove(ids, success, complete) {
  postRequest(protocolApi.batchDel, {}, {ids: ids}, success, complete)
}



export default {
  list,
  add,
  update,
  remove,
  load,
  batchRemove
}
